package com.cmbchina.encrypt;

/**
 * ErrorCode
 *
 * @author liuxb
 * @date 2021/11/26 22:26
 */
public enum ErrorCode {
    E10100("-10100", "No initialization log file path."),
    E10101("-10101", "A file with the same name exists in the specified log path."),
    E10102("-10102", "Bad log file path."),
    E10103("-10103", "No permission to create folders."),
    E10104("-10104", "Unauthorized access."),
    E10105("-10105", "cannot allocate memory."),
    E10106("-10106", "No permission to create file."),
    E10107("-10107", "No permission to write to log-file."),
    E10108("-10108", "Bad file path."),
    E10109("-10109", "Not Found file."),
    E10200("-10200", "Failed to encrypt data using SM2 public key."),
    E10201("-10201", "Failed to decrypt data using SM2 private key."),
    E10202("-10202", "Failed to signature data using SM2 private key."),
    E10203("-10203", "Failed to verify data using SM2 public key."),
    E10204("-10204", "Failed to encrypt data using SM4 algorithm."),
    E10205("-10205", "Failed to decrypt data using SM4 algorithm."),
    E10206("-10206", "Failed to mac data using SM4 algorithm."),
    E10207("-10207", "Failed to verify MAC using SM4 algorithm."),
    E10400("-10400", "Illegal Argument: cannot be NULL."),
    E10401("-10401", "Illegal Argument: cannot be NULL or empty."),
    E10402("-10402", "Illegal Argument: cannot be NULL, empty or blank."),
    E10403("-10403", "Illegal Argument: SM2 public key error, must be 65 bytes and in the format 04||X||Y."),
    E10404("-10404", "Illegal Argument: SM2 private key error, must be 32 bytes."),
    E10405("-10405", "Illegal Argument: SM2 signature error, must be 64 bytes and in the format r||s."),
    E10406("-10406", "Illegal Argument: SM2 cipher text error, must be more than 96 bytes and in the format C1||C3||C2."),
    E10407("-10407", "Illegal Argument: Output buffer is too small."),
    E10408("-10408", "Illegal Argument: The plaintext data length error, The data length must be a multiple of 16."),
    E10409("-10409", "Illegal Argument: The cipher text length error, The data length must be a multiple of 16."),
    E10410("-10410", "Illegal Argument: SM4 secret key error, must be 16 bytes."),
    E10411("-10411", "Illegal Argument: The size of IV error, must be 16 bytes."),
    E10412("-10412", "Illegal Argument: The size of MAC error, must be 16 bytes."),
    E10413("-10413", "The size of data in the MAC is too small."),
    E10414("-10414", "Illegal Argument: The size of POS-MAC error, must be 16 bytes."),
    E10415("-10415", "Illegal Argument: The size of msg too small."),
    E10416("-10416", "Illegal Argument: SM2 public key error."),
    E10417("-10417", "Illegal Argument: SM2 public key error, must be 65 bytes."),
    E10418("-10418", "Illegal Argument: SM2 private key error, must be 32 bytes."),
    E10419("-10419", "Illegal Argument: SM2 cipher text error, must be more than 97 bytes."),
    E10420("-10420", "Illegal Argument: Unmatched public and private key."),
    E10421("-10421", "Illegal Argument: Wrong public key."),
    E10422("-10422", "Illegal Argument: Wrong private key."),
    E10423("-10423", "Illegal Argument: SM3_HMAC key error, must be 64 bytes."),
    E10424("-10424", "Illegal Argument: SM2 cipher text format error, must be start with 04."),
    E10500("-10500", "Undefined error."),
    E10501("-10501", "DER encoded data encoding or decoding error.");

    private final String code;
    private final String message;

    private ErrorCode(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public String getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }


}

